Optimal. Leaf size=131 \[ a^2 (3 b B+a C) x+\frac {b \left (6 a b B+6 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a B (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac {b \left (2 a^2 B-b^2 B-3 a b C\right ) \tan (c+d x)}{d}-\frac {b^2 (2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 40, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.150, Rules used = {4157, 4110,
4133, 3855, 3852, 8} \begin {gather*} -\frac {b \left (2 a^2 B-3 a b C-b^2 B\right ) \tan (c+d x)}{d}+\frac {b \left (6 a^2 C+6 a b B+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 x (a C+3 b B)-\frac {b^2 (2 a B-b C) \tan (c+d x) \sec (c+d x)}{2 d}+\frac {a B \sin (c+d x) (a+b \sec (c+d x))^2}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4110
Rule 4133
Rule 4157
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+b \sec (c+d x))^3 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\int \cos (c+d x) (a+b \sec (c+d x))^3 (B+C \sec (c+d x)) \, dx\\ &=\frac {a B (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\int (a+b \sec (c+d x)) \left (-a (3 b B+a C)-b (b B+2 a C) \sec (c+d x)+b (2 a B-b C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {a B (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac {b^2 (2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}-\frac {1}{2} \int \left (-2 a^2 (3 b B+a C)-b \left (6 a b B+6 a^2 C+b^2 C\right ) \sec (c+d x)+2 b \left (2 a^2 B-b^2 B-3 a b C\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 (3 b B+a C) x+\frac {a B (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac {b^2 (2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}-\left (b \left (2 a^2 B-b^2 B-3 a b C\right )\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (b \left (6 a b B+6 a^2 C+b^2 C\right )\right ) \int \sec (c+d x) \, dx\\ &=a^2 (3 b B+a C) x+\frac {b \left (6 a b B+6 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a B (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac {b^2 (2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}+\frac {\left (b \left (2 a^2 B-b^2 B-3 a b C\right )\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}\\ &=a^2 (3 b B+a C) x+\frac {b \left (6 a b B+6 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a B (a+b \sec (c+d x))^2 \sin (c+d x)}{d}-\frac {b \left (2 a^2 B-b^2 B-3 a b C\right ) \tan (c+d x)}{d}-\frac {b^2 (2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(277\) vs. \(2(131)=262\).
time = 2.17, size = 277, normalized size = 2.11 \begin {gather*} \frac {4 a^2 (3 b B+a C) (c+d x)-2 b \left (6 a b B+6 a^2 C+b^2 C\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 b \left (6 a b B+6 a^2 C+b^2 C\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^3 C}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b^2 (b B+3 a C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}-\frac {b^3 C}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b^2 (b B+3 a C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+4 a^3 B \sin (c+d x)}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 141, normalized size = 1.08
method | result | size |
derivativedivides | \(\frac {b^{3} B \tan \left (d x +c \right )+C \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 a \,b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 C \,b^{2} a \tan \left (d x +c \right )+3 a^{2} b B \left (d x +c \right )+3 a^{2} b C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a^{3} B \sin \left (d x +c \right )+a^{3} C \left (d x +c \right )}{d}\) | \(141\) |
default | \(\frac {b^{3} B \tan \left (d x +c \right )+C \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 a \,b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 C \,b^{2} a \tan \left (d x +c \right )+3 a^{2} b B \left (d x +c \right )+3 a^{2} b C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+a^{3} B \sin \left (d x +c \right )+a^{3} C \left (d x +c \right )}{d}\) | \(141\) |
risch | \(3 B \,a^{2} b x +C \,a^{3} x -\frac {i a^{3} B \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i a^{3} B \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}-\frac {i b^{2} \left (C b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 B b \,{\mathrm e}^{2 i \left (d x +c \right )}-6 C a \,{\mathrm e}^{2 i \left (d x +c \right )}-C b \,{\mathrm e}^{i \left (d x +c \right )}-2 b B -6 a C \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a \,b^{2} B}{d}-\frac {3 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} C}{d}-\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a \,b^{2} B}{d}+\frac {3 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} C}{d}+\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{2 d}\) | \(272\) |
norman | \(\frac {\left (3 a^{2} b B +a^{3} C \right ) x +\left (-6 a^{2} b B -2 a^{3} C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-6 a^{2} b B -2 a^{3} C \right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-3 a^{2} b B -a^{3} C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-3 a^{2} b B -a^{3} C \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (3 a^{2} b B +a^{3} C \right ) x \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (12 a^{2} b B +4 a^{3} C \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (2 a^{3} B -2 b^{3} B -6 C \,b^{2} a +C \,b^{3}\right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (2 a^{3} B +2 b^{3} B +6 C \,b^{2} a +C \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 \left (2 a^{3} B -2 b^{3} B -6 C \,b^{2} a -C \,b^{3}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 \left (2 a^{3} B +2 b^{3} B +6 C \,b^{2} a -C \,b^{3}\right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (6 a^{3} B -2 b^{3} B -6 C \,b^{2} a -C \,b^{3}\right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (6 a^{3} B +2 b^{3} B +6 C \,b^{2} a -C \,b^{3}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{4}}-\frac {b \left (6 a b B +6 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {b \left (6 a b B +6 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(526\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 169, normalized size = 1.29 \begin {gather*} \frac {4 \, {\left (d x + c\right )} C a^{3} + 12 \, {\left (d x + c\right )} B a^{2} b - C b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, C a^{2} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, B a b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{3} \sin \left (d x + c\right ) + 12 \, C a b^{2} \tan \left (d x + c\right ) + 4 \, B b^{3} \tan \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.53, size = 167, normalized size = 1.27 \begin {gather*} \frac {4 \, {\left (C a^{3} + 3 \, B a^{2} b\right )} d x \cos \left (d x + c\right )^{2} + {\left (6 \, C a^{2} b + 6 \, B a b^{2} + C b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (6 \, C a^{2} b + 6 \, B a b^{2} + C b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, B a^{3} \cos \left (d x + c\right )^{2} + C b^{3} + 2 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.50, size = 241, normalized size = 1.84 \begin {gather*} \frac {\frac {4 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + 2 \, {\left (C a^{3} + 3 \, B a^{2} b\right )} {\left (d x + c\right )} + {\left (6 \, C a^{2} b + 6 \, B a b^{2} + C b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (6 \, C a^{2} b + 6 \, B a b^{2} + C b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (6 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.07, size = 249, normalized size = 1.90 \begin {gather*} \frac {\frac {B\,a^3\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {B\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {B\,a^3\,\sin \left (c+d\,x\right )}{4}+\frac {C\,b^3\,\sin \left (c+d\,x\right )}{2}+\frac {3\,C\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2}}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )}-\frac {2\,\left (-C\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {C\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,1{}\mathrm {i}}{2}-3\,B\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+B\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}+C\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________